import java.util.ArrayList;
import java.util.List;

class TreeNode {
    int val;
    TreeNode left;
    TreeNode right;
    TreeNode() {}
    TreeNode(int val) { this.val = val; }
    TreeNode(int val, TreeNode left, TreeNode right) {
        this.val = val;
        this.left = left;
        this.right = right;
    }
}
public class project {
    public List<Integer> luckyNumbers (int[][] matrix) {
        int row=matrix.length;
        int col=matrix[0].length;
        List<Integer> list=new ArrayList<>();
        for(int i=0;i<row;i++){
            int min=matrix[i][0];
            int k=0;
            for(int j=1;j<col;j++){
                if(matrix[i][j]<min){
                    min=matrix[i][j];
                    k=j;
                }
            }
            int x=0;
            for(;x<row;x++){
                if(matrix[x][k]>min){
                    break;
                }
            }
            if(x==row){
                list.add(min);
            }
        }
        return list;
    }













    public int singleNonDuplicate(int[] nums) {
        int ret=nums[0];
        for(int i=1;i<nums.length;i++){
            ret&=nums[i];
        }
        return ret;
    }
}
